<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"
                xmlns:sf="http://www.springframework.org/tags/faces"
                xmlns:sec="http://www.springframework.org/security/facelets/tags"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:c="http://java.sun.com/jstl/core" 
				template="/WEB-INF/layouts/template.xhtml">

<ui:define name="main">
<script type="text/javascript">document.getElementById('menuMembers').className="selected";</script>
<div id="main">
	<div id="wrapper" class="yui-b">
		<h3 class="title">
			<h:outputText value="${msg.title_member_edit} ${member.contact.name}" rendered="${!(member.id eq 0)}"/>
			<h:outputText value="${msg.title_member_add}" rendered="${member.id eq 0}"/>
		</h3>
		<ui:fragment id="messages">
			<div id="messagesInsertionPoint">
				<h:messages errorClass="errors" />
			</div>
		</ui:fragment>
		<div class="wrapper">
			<h:form id="member">
				<div class="field">
					<div class="label">
						<h:outputLabel for="cname">${msg.name} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="cname" value="${member.contact.name}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="position">${msg.position} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="position" value="${member.position}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="cemail">${msg.email} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="cemail" value="${member.contact.email}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="cmobile">${msg.mobile} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="cmobile" value="${member.contact.mobile}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="cphone">${msg.phone} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="cphone" value="${member.contact.phone}" />
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="cfax">${msg.fax} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="cfax" value="${member.contact.fax}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="workdaylength">${msg.workdaylength} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="workdaylength" value="${member.workDayLength}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="timezones">${msg.timezone} </h:outputLabel>
					</div>
					<div class="input">
						<rich:comboBox id="timezones" selectFirstOnUpdate="false" value="${member.timezone}">
        					<c:forEach items="${viewScope.timezones}" var="t">
								<f:selectItem itemValue="${t.key}" itemLabel="${t.value}"/>
								<f:converter converterId="timeZoneConverter"/>
							</c:forEach>
    					</rich:comboBox>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="username">${msg.username} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputText id="username" value="${member.username}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="password" rendered="${member.id eq 0}">${msg.password} </h:outputLabel>
						<h:outputLabel for="password" rendered="${!(member.id eq 0)}">${msg.changepassword} </h:outputLabel>
					</div>
					<div class="input">
						<h:inputSecret id="password" value="${member.password}" rendered="${member.id eq 0}"/>
						<h:inputSecret id="newpassword1" value="${flowScope.newpassword1}" rendered="${!(member.id eq 0)}"/>
						<h:inputSecret id="newpassword2" value="${flowScope.newpassword2}" rendered="${!(member.id eq 0)}"/>
					</div>
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="enabled">${msg.enabled} </h:outputLabel>
					</div>
					<div class="input">
						<h:selectBooleanCheckbox id="enabled" value="${member.enabled}" />
					</div>
				</div>
				<h:panelGroup rendered="${group eq null}">
					<div class="field">
						<div class="label">
							<h:outputLabel for="admin">${msg.isadmin} </h:outputLabel>
						</div>
						<div class="input">
							<h:selectBooleanCheckbox id="admin" value="${flowScope.admin}" />
						</div>
					</div>
				</h:panelGroup>
				<div style="clear: both; height: 5px;" />
				<div>
					<sf:commandLink id="save" action="save" processIds="*" rendered="${!(member.id eq 0)}"><div class="button">${msg.save}</div></sf:commandLink>
					<sf:commandLink id="create" action="create" processIds="*" rendered="${member.id eq 0}"><div class="button">${msg.create} ${msg.member}</div></sf:commandLink>
				</div>
				<div style="clear: both; height: 5px;" />
			</h:form>
		</div>
	</div>
</div>
<div style="clear: both; height: 5px;" />
<div>
	<h:form>
		<sf:commandLink id="back" action="back"  rendered="${!(member.id eq 0)}"><div class="button">${msg.back} ${msg.member}</div></sf:commandLink>
		<sf:commandLink id="cancel"  action="cancel" rendered="${(member.id eq 0) and (group eq null)}"><div class="button">${msg.cancel}</div></sf:commandLink>
	</h:form>
</div>
</ui:define>
</ui:composition>